All Questions
5 questions
6votes
4answers
1kviews
How to avoid init methods when 2 objects need the reference of each other?
According to https://softwareengineering.stackexchange.com/a/334994/432039, I know init is a code smell and should be avoided, and one of the solutions is to use a builder to hold the state first ...
3votes
5answers
1kviews
Using a variable to indicate object type
The use of instanceof or getClass() is largely considered code smell. Is using a variable to indicate the type of object you're using also considered code smell? Suppose if I had an enum called ...
6votes
4answers
11kviews
Are empty interfaces (but not marker interfaces) a bad programming practice?
I'm designing an architecture in which I have: public interface IObjectReader{ public Object read(); } public class ConcreteObjectReader implements IObjectReader{ @Override public ...
31votes
9answers
31kviews
Are init() methods a code smell?
Is there any purpose for declaring an init() method for a type? I'm not asking whether we should prefer init() over a constructor or how to avoid declaring init(). I'm asking if there is any ...
10votes
3answers
3kviews
Clean Code and Hybrid Objects and Feature Envy
So I recently made some major refactorings to my code. One of the main things I tried to do was split out my classes into data objects and worker objects. This was inspired, among other things, by ...